package io.gitee.hchaojie.day08.thread.exam;

public class Consumer extends Thread {
    private Factory f;

    public Consumer(Factory f) {
        this.f = f;
    }

    public void run() {
        while (true) {
            try {
                Thread.sleep((long) (Math.random() * 20));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            this.f.consume();
        }
    }
}
